home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / drcpas10.zip / SS.PAS < prev    next >
Pascal/Delphi Source File  |  1992-11-17  |  1KB  |  50 lines

  1. program ss;
  2.  
  3. uses crt, keyboard, scrsaver;
  4.  
  5. (* along with scrsaver.pas this is an example of the screen-saving
  6.    abilities of keyboard.pas.  I also have code to allow mouse events
  7.    to update the 'lastkeypress' and a cool graphics screen saver,
  8.    as well as line-oriented input with editing (the screen saver will
  9.    not activate while a readln is pending), but that code is "not
  10.    ready for prime time."  Expect it in 1.1, before the end of Nov 92.
  11.  
  12.    The programmer must install a screen saving procedure to enable,
  13.    and setting @screensaver := nil; will disable it.  Remember when
  14.    re-enabling the screen saver to reset the lastkeypress, e.g.
  15.  
  16.    @screensaver := nil;
  17.    ...
  18.    lastkeypress := ClockTix;
  19.    screensaver := mysaver;
  20.  
  21.    The timeout defaults to five minutes (5460 clock ticks); it can
  22.    be set, e.g. timeout := 10 * 60 * TIX_PER_SECOND; (ten minutes)
  23. *)
  24.  
  25. var
  26.   ch : char;
  27.  
  28. begin
  29.   screensaver := savescr;
  30.   timeout := 91;             (* five seconds: default is five minutes *)
  31.   textcolor (yellow);
  32.   textbackground (blue);
  33.   repeat
  34.     clrscr;
  35.     gotoxy (30, 9);
  36.     write ('D - Do nothing');
  37.     gotoxy (30, 10);
  38.     write ('E - Exit');
  39.     gotoxy (30, 12);
  40.     write ('Choose: ');
  41.     repeat
  42.       ch := upcase(readkey);
  43.     until ch in ['D','E'];
  44.     writeln (ch);
  45.   until ch = 'E';
  46.   textcolor (lightgray);
  47.   textbackground (black);
  48.   clrscr;
  49. end.
  50.